<template>
  <div>
    <div class="circle">
      <img
        src="../assets/fan.png"
        alt=""
        :class="{'rotate-3-gear':(isT && threeGear),'rotate-2-gear':(isT && twoGear),'rotate-1-gear':(isT && oneGear)}"
      >
    </div>
    <div class="btn-group">
      <div
        class="little-circle"
        @click="stop"
      >
        <span>关</span>
      </div>
      <div
        class="little-circle"
        @click="oneGearFn"
      >
        <span>1</span>
      </div>
      <div
        class="little-circle"
        @click="twoGearFn"
      >
        <span>2</span>
      </div>
      <div
        class="little-circle"
        @click="threeGearFn"
      >
        <span>3</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isT: false,
      oneGear: false,
      twoGear: false,
      threeGear: false
    }
  },
  methods: {
    stop () {
      this.isT = false
    },
    oneGearFn () {
      this.oneGear = true
      this.isT = true
      this.twoGear = false
      this.threeGear = false
    },
    twoGearFn () {
      this.twoGear = true
      this.isT = true
      this.oneGear = false
      this.threeGear = false
    },
    threeGearFn () {
      this.threeGear = true
      this.isT = true
      this.oneGear = false
      this.twoGear = false
    }
  }
}
</script>

<style lang="less" scoped>
.circle {
  position: relative;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 3px solid black;
  margin: 50px auto;
  overflow: hidden;
  background-color: rgb(254, 252, 229);
  img {
    width: 100%;
  }
}
.btn-group {
  width: 100%;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-left: -10px;
  .little-circle {
    border: 2px solid black;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(249, 234, 178, 1);
    text-align: center;
    font-size: 18px;
    line-height: 50px;
    margin-left: 10px;
    cursor: pointer;
  }
}
.rotate-3-gear {
  animation: rotate 0.1s infinite linear;
}
.rotate-2-gear {
  animation: rotate 1s infinite linear;
}
.rotate-1-gear {
  animation: rotate 5s infinite linear;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
</style>
